package com.xywh.micro_warehousing.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xywh.micro_warehousing.R;
import com.xywh.micro_warehousing.mvp.ui.entity.Tab3;
import com.xywh.micro_warehousing.mvp.ui.util.GlideUtil;

import java.util.List;


public class Tab3Adapter extends BaseQuickAdapter<Tab3, BaseViewHolder> {

    private Context mContext;

    public Tab3Adapter(Context context, @Nullable List<Tab3> data) {
        super(R.layout.item_tab3, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, Tab3 item) {
        if (item.getInouttype().equals("0")) {
            GlideUtil.loadImage(mContext, R.drawable.icon_picking, helper.getView(R.id.img_head));
            helper.setText(R.id.tv_type_of_use, "物资领用");

        } else if (item.getInouttype().equals("1")) {
            GlideUtil.loadImage(mContext, R.drawable.icon_return, helper.getView(R.id.img_head));
            helper.setText(R.id.tv_type_of_use, "物资归还");
        }
        helper.setText(R.id.tv_title, item.getMaterial());
        TextView tv_rfid = helper.getView(R.id.tv_rfid);
//        if (item.getImg() == R.drawable.icon_storage) {
//            tv_rfid.setVisibility(View.GONE);
//        }
        tv_rfid.setText(item.getMmodel());
        helper.setText(R.id.tv_time, item.getInouttime());
        helper.setText(R.id.tv_quantity, item.getNums());

    }

}
